import { Refs } from 'share/declare'

export interface RteInputReactiveMap {
  showlist: boolean
}

export interface RteInputRefs extends Refs {
  root: HTMLDivElement
  caret: HTMLSpanElement
  select: HTMLUListElement
  interim: HTMLStyleElement
}

export type RecordFromArrayLike<T extends readonly any[], V> = {
  [K in T extends ArrayLike<infer U> ? U : never]: V
}

export type MapFromArrayLike<T extends readonly any[]> = {
  [K in T extends ArrayLike<infer U> ? U : never]: unknown
}

export const MULTI_VALUE: string[] = ['text-decoration-line']

/* ------------------------------------------------------------- 文字样式 ------------------------------------------------------------- */

export const TextStylePropties = [
  'color',
  'font-family',
  'font-size',
  'font-weight',
  'font-style',
  'background-color',
  'text-decoration-line',
] as const

export type TextStyleProp = typeof TextStylePropties

// export type TextStyleMap = Partial<RecordFromArrayLike<TextStyleProp, string>>

/* ------------------------------------------------------------- 段落外样式 ------------------------------------------------------------- */

export const ParagraphOutlinePropties = ['margin-left', 'margin-top', 'margin-right', 'margin-bottom'] as const

export const ParagraphOutlineProp = typeof ParagraphOutlinePropties

/* ------------------------------------------------------------- 段落内样式 ------------------------------------------------------------- */

export const ParagraphInlinePropties = [
  'color',
  'background-color',
  'font-family',
  'font-size',
  'line-height',
  'text-indent',
  'text-align',
  'padding-left',
  'padding-top',
  'padding-right',
  'padding-bottom',
] as const

export const ParagraphInlineProp = typeof ParagraphInlinePropties

/* ------------------------------------------------------------- 段落样式 ------------------------------------------------------------- */

export const ParagraphStylePropties = [...ParagraphInlinePropties, ...ParagraphOutlinePropties] as const

export type ParagraphStyleProp = typeof ParagraphStylePropties

// export type ParagraphStyleMap = Partial<RecordFromArrayLike<ParagraphStyleProp, string>>
